<template>
    <div> 
        <el-button type="primary" @click="showById">添加</el-button>
        <el-button>返回</el-button>
        <el-table :data="tableData" border style="width: 62%">   <!-- 表格与网页同宽 -->
            <el-table-column
                prop="checkedTime"
                label="检测时间"
                align="center"
                width="180">
            </el-table-column>
            <el-table-column
                prop="HS_result"
                label="核酸结果"
                align="center"
                width="220"
                class="box">
            </el-table-column>
            <el-table-column
                prop="CT_result"
                label="CT结果"
                align="center"
                width="220"
                class="box">
            </el-table-column>
            <el-table-column
                prop="operate"
                label="操作"
                align="center"
                width="200">
                <template>
                    <el-button type="danger" size="mini" @click="open">删除</el-button>
                </template>
            </el-table-column>
        </el-table>
        <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="currentPage4"
            :page-sizes="[1, 2, 3]"
            :page-size="100"
            layout="total, sizes, prev, pager, next, jumper"
            :total="3">
        </el-pagination>
    </div>
</template>
<script>
import request from '@/utils/request'

export default {
  data() {
    return {
      input: '',
      tableData: null,
      currentPage1: 5,
      currentPage2: 5,
      currentPage3: 5,
    }   
  },
  created(){
      this.fetchData()
  },
  methods:{
      fetchData(){
          request({
            url: '../checked_list.json',
            method: 'get',   //发请求
          }).then(response => {
            this.tableData = response.data
          })
      },
      handleEdit(){
          this.$router.push({
              path:'patient/checkList'
          })
      },
      showById(){
          this.$router.push("/patient/add_check")
      },
      open() {
        this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.$message({
            type: 'success',
            message: '删除成功!'
          });
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          });          
        });
      }
    },

  }
</script>